<template>
    <div class="businessContainer" >
        <resturant-list :url="url" ref="resturantList"></resturant-list>
    </div>
    
</template>


<script>
import { Toast } from 'mint-ui';
export default {
    
    data(){
        return {
            typeId:null,
            url:"resturant/get/all",
            isFresh:true,
        }
    },
    methods:{
        
    },
    activated() {
        document.getElementsByClassName("businessContainer")[0].scrollTop = this.offsetTop;
        this.isFresh = true;
    },
    deactivated() {
    　　this.offsetTop = document.getElementsByClassName("businessContainer")[0].scrollTop;
    }, 
    created(){
        this.typeId = this.$route.query.type;
        if(this.typeId != null && this.typeId != ""){
            this.url = `resturant/byType/get?type=${this.typeId}`;
        }
        this.isFresh = false;
    },
    mounted(){
    },
     beforeRouteLeave(to, from, next){
        from.meta.keepAlive = true;
        from.meta.keepAlive_two = true;
        next();
    },
    beforeRouteEnter(to, from, next){
        let type = to.query.type
        if(type!=null && from.name=="homePage"){
              next(vm=>{
                  vm.url = `resturant/byType/get?type=${type}`;
                  vm.$refs.resturantList.reset(vm.url);
            });
            return;
        }
        next();
    },
    
}
</script>


<style scoped>
    .businessContaine2{
        background-color: red;
        height: 1500px;
        width: 100%;
        padding-bottom: 250px;
    }

    .businessContainer{
        height: 100%;
        width: 100%;
        overflow: auto;
    }

</style>

